

//
//  HealthKnowViewController.m
//  happyHealthyWalk
//
//  Created by newhuidong on 16/2/22.
//  Copyright © 2016年 HuiDong. All rights reserved.
//

#import "HealthKnowViewController.h"
#import "Header.h"
@interface HealthKnowViewController ()<UITableViewDataSource,UITableViewDelegate>

@property(nonatomic,strong)UITableView * tableView;

@property(nonatomic,strong)NSArray *imageArr;
@property(nonatomic,strong)NSArray *titleArr;



@end

@implementation HealthKnowViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title=@"健康知识";
    
    
    
    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.tintColor=[UIColor whiteColor];
    self.navigationController.navigationBar.barTintColor=GreenColor;
    
    self.navigationController.navigationBar.translucent=NO;
    self.navigationController.navigationBar.shadowImage=[UIImage new];
    
    self.tableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, ScreenW, ScreenH-64) style:UITableViewStylePlain];
    
    
    self.tableView.delegate=self;
    self.tableView.dataSource=self;
    
    UIImageView * imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, ScreenW, 200)];
    
    imageView.image=[UIImage imageNamed:@"banner"];
    
   // [self.view addSubview:imageView];
    [self.view addSubview:self.tableView];
    self.tableView.tableHeaderView=imageView;
    
    _titleArr=@[@"测试必读",@"奖励规则",@"乳腺疾病知识",@"胃癌疾病知识",@"肠癌疾病知识",@"我的奖励",];
    
    
    _imageArr=@[@"ceshi",@"jiangli",@"ruxian",@"changwei",@"changai",@"wode",];
    
}


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return _titleArr.count;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString * identifer=@"cell";
    
    UITableViewCell * cell=[tableView dequeueReusableCellWithIdentifier:identifer];
    
    if (cell==nil) {
        
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifer];
    }
    
    cell.textLabel.text=_titleArr[indexPath.row];
    cell.imageView.image=[UIImage imageNamed:[NSString stringWithFormat:@"%@",_imageArr[indexPath.row]]];
    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    
    //cell.selectionStyle=UITableViewCellSelectionStyleNone;
    
    return cell;
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
    
    switch (indexPath.row) {
        case 0:
            NSLog(@"测试必读");
            break;
        case 1:
            NSLog(@"奖励规则");
            break;
        case 2:
            NSLog(@"乳腺疾病知识");
            break;
        case 3:
            NSLog(@"胃癌疾病知识");
            break;
        case 4:
            NSLog(@"肠癌疾病知识");
            break;
        case 5:
            NSLog(@"我的奖励");
            break;
        default:
            break;
    }
    
}

@end
